Repository navigation
feat(config): report config drift — the schema detector gets a caller, features get a detector - #512
Merged
Merged
Conversation
…, features get a detector A .kit.toml falls behind in two ways and neither reached the operator (#511). Schema drift had a working detector and no caller. `kit config migrate --check` has answered "Config is at v0; current is v1" since versioning landed, while `kit status` said only `✓ .kit.toml present` — and "present" is not "current". Measured on kit's own repo: the config was v0 while the schema was v1, and nothing said so until someone asked directly. `kit status` now carries a `config schema` row via a new read-only `planConfigMigration()`, which answers without any write path (asserted: the file is byte-identical afterwards). Feature drift had no detector at all. A long-lived config does not know about the sections kit has learned since — [context], [policy.agent_writes], [deploy], [governance.audit] require_anchor. applyRecommendedHardening() knew the recommended posture but was reachable only from `kit setup`, which APPLIES it, touching ~/.claude, ~/.codex and the repo's git hooks — so asking "what would I get?" meant letting it happen. New `kit config recommend [--json]` reports it and writes nothing. Each row says what the piece BUYS rather than that it is absent; a checklist of missing features is how a report gets ignored. The pre-push context row points at declaring [context] first rather than at installing a gate that cannot fail, matching the refusal added in #497. Deliberately not a `kit rebase` verb: rebase means something specific and different to every git user, and both halves of this were a missing reader, not a missing command. Auto-migrating on load is also out — a config that changes shape underneath a session is worse than one that is behind. One existing fixture asserted that a "fully configured" project has every signal green while its .kit.toml carried no version stamp. The new row is right about that, so the fixture now stamps CONFIG_SCHEMA_VERSION rather than the row being softened. Closes #511 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
✅ Docker image built successfully
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #511.
Two drifts, two missing readers
Schema drift had a detector and no caller.
kit config migrate --checkhas answered this since versioning landed:kit statussaid only✓ .kit.toml present, and present is not current. Measured on kit's own repo — the config was v0 while the schema was v1, unreported until someone asked directly. Now:The row goes through a new read-only
planConfigMigration(): same detection, no write path at all. A test asserts the file is byte-identical afterwards, because a status row that can rewrite your config would be a worse defect than the one it fixes.Feature drift had no detector. A long-lived
.kit.tomldoes not know about[context],[policy.agent_writes],[deploy],[governance.audit] require_anchor.applyRecommendedHardening()knew the recommended posture and was reachable only fromkit setup, which applies it — touching~/.claude,~/.codexand the repo's git hooks. So "what would I get?" could only be answered by letting it happen.Two deliberate details:
NOT CHECKEDrows in feat(tools): verify the CLIs kit says it manages — version, provenance, currency #504 carry reasons.[context]first, not at installing the gate, becausekit hooks add context-checknow refuses without it (kit hooks add context-check installs a gate that cannot fail when [context] is absent — no warning, wrong test hint, and no git-hook row in kit status #497). A recommendation that walks you into a refusal is not a recommendation.On the shape this was raised as
Not a
kit rebaseverb.rebasealready means something specific and different to every git user, and both halves here were a missing reader, not a missing command — the detection existed or the knowledge existed, and nothing surfaced either. Auto-migrating on load is also out: a config that changes shape underneath a running session is worse than one that is behind, and the schema version exists precisely so the change is explicit and reviewable.One fixture was wrong, and the row was right
status.test.ts's "configured project: every signal on" built a fully-configured repo whose.kit.tomlcarried no version stamp — so the new row flagged it, correctly. The fixture now stampsCONFIG_SCHEMA_VERSION(from the constant, so it cannot rot behind it) rather than the row being softened to keep a green test.Tests
src/config-drift.test.ts— 10:planConfigMigration: legacy config reported behind with both versions named; a stamped config reported current;nullrather than a guess for an absent or malformed config; and writes nothing (byte-identical file)recommendPosture: nothing adopted for a bare config with every row carrying a non-trivial "buys" line and ahow; declared sections marked adopted with thehowdropped; the[context]-first ordering for the pre-push gate; installed git/memory hooks read as adoptedkit statusnames the schema gap and the command that fixes it;kit config recommend --jsonreturns the rows and leaves the directory listing unchangedVerification
npm test: 4439 tests, 0 fail, 0 skipped (macOS, non-root)kit self-audit: 16 rules, 0 fail, 0 warn — includingundocumented commands, which the new subcommand had to satisfy (docs/COMMANDS.md)eslint src: 0 errors ·prettier --check "src/**/*.ts"clean🤖 Generated with Claude Code